package com.lanyam.travel.base.service.impl;


import com.lanyam.travel.base.entity.CashRecord;
import com.lanyam.travel.base.entity.vo.CashRecordVo;
import com.lanyam.travel.base.dao.CashRecordMapper;
import com.lanyam.travel.base.service.ICashRecordService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;
import java.util.Map;
import javax.annotation.Resource;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;


@Service
@Transactional
@Slf4j
public class CashRecordServiceImpl implements ICashRecordService {

    @Resource
    private CashRecordMapper cashRecordMapper;

    @Override
    public IPage<CashRecordVo> getPageCashRecord (Map<String, Object> queryMap, Integer page, Integer rows) {
        Page<CashRecordVo> pageSize = new Page<CashRecordVo>(page, rows);
        Page<CashRecordVo> pageInfo = cashRecordMapper.getPage(pageSize, queryMap);
        return pageInfo;
    }

    @Override
    public void addCashRecord(CashRecord cashRecord) {
        cashRecordMapper.insert(cashRecord);
    }

    @Override
    public void updateCashRecord(CashRecord cashRecord) {
        cashRecordMapper.updateById(cashRecord);
    }

    @Override
    public void delById(String id) {
        cashRecordMapper.delById(id);
    }
}